<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');


class View_jpc extends CI_Controller {
	
	public function __construct() 
	{
		parent::__construct();
		
		$this->load->model('model_jpc');
		$this->load->model('model_auth');

	}
	
	
	public function index($q='pendaftar')
	{	
		if ($q=='pendaftar') {
			$data= array (
				'data'=>$this->model_jpc->_get_all(),
				'param'=>$q,
				'title'=>'Pendaftar ITB Junior Programming Contest 2011'
				);
						
			} else 
		if ($q=='kontestan') {	
			$data= array (
				'data'=>$this->model_jpc->_get_valid(),
				'param'=>$q,
				'title'=>'Kontestan ITB Junior Programming Contest 2011'
				);
				
			} else 
		if ($q=='finalis') {
			$data= array (
				'data'=>$this->model_jpc->_get_finalis(),
				'param'=>$q,
				'title'=>'Finalis ITB Junior Programming Contest 2011'
				);
			} else {
			redirect('jpc/view','location');	
			}
		
		$this->load->view('header',$data);
		$this->load->view('jpc/view_jpc',$data);
		$this->load->view('footer'); 
	}	
	
	public function kontestan () {
		redirect('view_jpc/index/kontestan','location');
	}
	
	public function finalis () {
		redirect('view_jpc/index/finalis','location');
	}
	
}
